<template>
  <el-container class="layout-container-demo" style="height: 100vh">
    <el-aside :width="aside_width">
      <Aside :isCollapse="isCollapse"></Aside>
    </el-aside>

    <el-container style="height: 100%">
      <el-header style="border-bottom: hsl(30, 0%, 66%) 1px solid; height: 60px">
        <Header @doCollapse="doCollapse" :isCollapse="isCollapse"></Header>
      </el-header>

      <el-main style="height: 100%; width: 80%; margin: auto">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script scope>
import '../assets/global.css';
import Aside from './Aside.vue';
import Header from './Header.vue';
export default {
  name: 'IndexMain',
  components: { Aside, Header },
  data() {
    return {
      isCollapse: false,
      aside_width: '200px',
    };
  },
  methods: {
    doCollapse() {
      this.isCollapse = !this.isCollapse;
      if (!this.isCollapse) {
        //展开
        this.aside_width = '200px';
      } else {
        this.aside_width = '64px';
      }
    },
  },
};
</script>

<style scoped>
.layout-container-demo .el-header {
  position: relative;
  color: var(--el-text-color-primary);
}
.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}
.layout-container-demo .el-menu {
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
}
.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>
